{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import easyquotation\n",
    "# quotation."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'sh510050': {'name': '上证50ETF',\n",
       "  'open': 3.184,\n",
       "  'close': 3.186,\n",
       "  'now': 3.167,\n",
       "  'high': 3.197,\n",
       "  'low': 3.148,\n",
       "  'buy': 3.166,\n",
       "  'sell': 3.167,\n",
       "  'turnover': 794308582,\n",
       "  'volume': 2520730333.0,\n",
       "  'bid1_volume': 536200,\n",
       "  'bid1': 3.166,\n",
       "  'bid2_volume': 3256600,\n",
       "  'bid2': 3.165,\n",
       "  'bid3_volume': 182800,\n",
       "  'bid3': 3.164,\n",
       "  'bid4_volume': 778400,\n",
       "  'bid4': 3.163,\n",
       "  'bid5_volume': 365700,\n",
       "  'bid5': 3.162,\n",
       "  'ask1_volume': 3013200,\n",
       "  'ask1': 3.167,\n",
       "  'ask2_volume': 300300,\n",
       "  'ask2': 3.168,\n",
       "  'ask3_volume': 2579900,\n",
       "  'ask3': 3.169,\n",
       "  'ask4_volume': 1054100,\n",
       "  'ask4': 3.17,\n",
       "  'ask5_volume': 96100,\n",
       "  'ask5': 3.171,\n",
       "  'date': '2021-09-16',\n",
       "  'time': '15:00:00'},\n",
       " 'sh510300': {'name': '沪深300ETF',\n",
       "  'open': 4.945,\n",
       "  'close': 4.945,\n",
       "  'now': 4.889,\n",
       "  'high': 4.955,\n",
       "  'low': 4.881,\n",
       "  'buy': 4.889,\n",
       "  'sell': 4.89,\n",
       "  'turnover': 429348425,\n",
       "  'volume': 2106848912.0,\n",
       "  'bid1_volume': 718500,\n",
       "  'bid1': 4.889,\n",
       "  'bid2_volume': 53700,\n",
       "  'bid2': 4.887,\n",
       "  'bid3_volume': 600000,\n",
       "  'bid3': 4.885,\n",
       "  'bid4_volume': 70400,\n",
       "  'bid4': 4.884,\n",
       "  'bid5_volume': 168200,\n",
       "  'bid5': 4.883,\n",
       "  'ask1_volume': 695100,\n",
       "  'ask1': 4.89,\n",
       "  'ask2_volume': 74700,\n",
       "  'ask2': 4.891,\n",
       "  'ask3_volume': 8900,\n",
       "  'ask3': 4.892,\n",
       "  'ask4_volume': 10700,\n",
       "  'ask4': 4.893,\n",
       "  'ask5_volume': 54200,\n",
       "  'ask5': 4.894,\n",
       "  'date': '2021-09-16',\n",
       "  'time': '15:00:00'},\n",
       " 'sh510500': {'name': '中证500ETF',\n",
       "  'open': 8.53,\n",
       "  'close': 8.524,\n",
       "  'now': 8.369,\n",
       "  'high': 8.6,\n",
       "  'low': 8.363,\n",
       "  'buy': 8.368,\n",
       "  'sell': 8.369,\n",
       "  'turnover': 132568026,\n",
       "  'volume': 1124057133.0,\n",
       "  'bid1_volume': 26200,\n",
       "  'bid1': 8.368,\n",
       "  'bid2_volume': 10800,\n",
       "  'bid2': 8.367,\n",
       "  'bid3_volume': 39100,\n",
       "  'bid3': 8.366,\n",
       "  'bid4_volume': 25700,\n",
       "  'bid4': 8.365,\n",
       "  'bid5_volume': 9300,\n",
       "  'bid5': 8.364,\n",
       "  'ask1_volume': 734600,\n",
       "  'ask1': 8.369,\n",
       "  'ask2_volume': 78500,\n",
       "  'ask2': 8.37,\n",
       "  'ask3_volume': 98500,\n",
       "  'ask3': 8.371,\n",
       "  'ask4_volume': 7600,\n",
       "  'ask4': 8.372,\n",
       "  'ask5_volume': 300,\n",
       "  'ask5': 8.373,\n",
       "  'date': '2021-09-16',\n",
       "  'time': '15:00:00'}}"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "quotation = easyquotation.use('sina') # 新浪 ['sina'] 腾讯 ['tencent', 'qq']\n",
    "hq = quotation.stocks(['510050', '510300', '510500'], prefix=True)\n",
    "hq"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "quotation = easyquotation.use('jsl') # ['jsl']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 本示例运行于python3.6及以上版本\n",
    "from gmtrade.api import *\n",
    "\n",
    "# token身份认证\n",
    "set_token(\"5be220861ce35a6f97f9398d7967fde449f8ddaf\")\n",
    "\n",
    "# 示例中为掘金官方仿真服务地址；如API接入掘金终端，则填空字符串\n",
    "set_endpoint(\"api.myquant.cn:9000\")\n",
    "\n",
    "# 登录账户，account_id为账户ID，必填；account_alias为账号别名，选填\n",
    "stock = account(account_id='d9e8ca3a-12dc-11ec-a19e-00163e0a4100', account_alias='stock')\n",
    "future = account(account_id='32a1da7c-12dd-11ec-a19e-00163e0a4100', account_alias='future')\n",
    "# 可login多个账户，如login(a1, a2, a3)\n",
    "login(stock, future)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "get_cash cash=account_id: \"d9e8ca3a-12dc-11ec-a19e-00163e0a4100\"\n",
      "account_name: \"d9e8ca3a-12dc-11ec-a19e-00163e0a4100\"\n",
      "nav: 1000000.0\n",
      "available: 1000000.0\n",
      "cum_inout: 1000000.0\n",
      "last_inout: 1000000.0\n",
      "change_reason: 2\n",
      "created_at {\n",
      "  seconds: 1631350029\n",
      "  nanos: 981501268\n",
      "}\n",
      "updated_at {\n",
      "  seconds: 1631350030\n",
      "  nanos: 444716\n",
      "}\n",
      "\n"
     ]
    },
    {
     "ename": "NameError",
     "evalue": "name 'aa' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-10-9d1b4f27e95a>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m      3\u001b[0m \u001b[0mfuture_cash\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mget_cash\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfuture\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      4\u001b[0m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34mf\"get_cash cash={stock_cash}\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 5\u001b[1;33m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34mf\"get_cash cash={aa}\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m: name 'aa' is not defined"
     ]
    }
   ],
   "source": [
    "# 获取登录账户的资金，如登录多个账户需要指定账户ID\n",
    "stock_cash = get_cash(stock)\n",
    "future_cash = get_cash(future)\n",
    "print(f\"get_cash cash={stock_cash}\")\n",
    "print(f\"get_cash cash={future_cash}\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "get_positions poes=[]\n"
     ]
    }
   ],
   "source": [
    "# 获取登录账户的持仓，如登录多个账户需要指定账户ID\n",
    "stock_poses = get_positions(stock)\n",
    "print(f\"get_positions poes={stock_poses}\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from mootdx.quotes import Quotes\n",
    "\n",
    "# 标准市场\n",
    "client = Quotes.factory(market='std', multithread=True, heartbeat=True, bestip=True, timeout=15)\n",
    "\n",
    "# k 线数据\n",
    "client.bars(symbol='600036', frequency=9, offset=10)\n",
    "\n",
    "# 指数\n",
    "client.index(symbol='000001', frequency=9)\n",
    "\n",
    "# 分钟\n",
    "client.minute(symbol='000001')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>market</th>\n",
       "      <th>code</th>\n",
       "      <th>active1</th>\n",
       "      <th>price</th>\n",
       "      <th>last_close</th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>reversed_bytes0</th>\n",
       "      <th>reversed_bytes1</th>\n",
       "      <th>...</th>\n",
       "      <th>ask5</th>\n",
       "      <th>bid_vol5</th>\n",
       "      <th>ask_vol5</th>\n",
       "      <th>reversed_bytes4</th>\n",
       "      <th>reversed_bytes5</th>\n",
       "      <th>reversed_bytes6</th>\n",
       "      <th>reversed_bytes7</th>\n",
       "      <th>reversed_bytes8</th>\n",
       "      <th>reversed_bytes9</th>\n",
       "      <th>active2</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>000001</td>\n",
       "      <td>4708</td>\n",
       "      <td>19.08</td>\n",
       "      <td>19.52</td>\n",
       "      <td>19.30</td>\n",
       "      <td>19.50</td>\n",
       "      <td>18.73</td>\n",
       "      <td>14998393</td>\n",
       "      <td>-1908</td>\n",
       "      <td>...</td>\n",
       "      <td>19.12</td>\n",
       "      <td>29</td>\n",
       "      <td>467</td>\n",
       "      <td>(3606,)</td>\n",
       "      <td>1</td>\n",
       "      <td>-25</td>\n",
       "      <td>-98</td>\n",
       "      <td>153</td>\n",
       "      <td>127</td>\n",
       "      <td>4708</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>600300</td>\n",
       "      <td>1064</td>\n",
       "      <td>3.52</td>\n",
       "      <td>3.53</td>\n",
       "      <td>3.52</td>\n",
       "      <td>3.57</td>\n",
       "      <td>3.52</td>\n",
       "      <td>15000049</td>\n",
       "      <td>-352</td>\n",
       "      <td>...</td>\n",
       "      <td>3.57</td>\n",
       "      <td>2674</td>\n",
       "      <td>5434</td>\n",
       "      <td>(22,)</td>\n",
       "      <td>1</td>\n",
       "      <td>-4</td>\n",
       "      <td>-2</td>\n",
       "      <td>2</td>\n",
       "      <td>65509</td>\n",
       "      <td>1064</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2 rows × 44 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   market    code  active1  price  last_close   open   high    low  \\\n",
       "0       0  000001     4708  19.08       19.52  19.30  19.50  18.73   \n",
       "1       1  600300     1064   3.52        3.53   3.52   3.57   3.52   \n",
       "\n",
       "   reversed_bytes0  reversed_bytes1  ...   ask5  bid_vol5  ask_vol5  \\\n",
       "0         14998393            -1908  ...  19.12        29       467   \n",
       "1         15000049             -352  ...   3.57      2674      5434   \n",
       "\n",
       "   reversed_bytes4  reversed_bytes5  reversed_bytes6  reversed_bytes7  \\\n",
       "0          (3606,)                1              -25              -98   \n",
       "1            (22,)                1               -4               -2   \n",
       "\n",
       "   reversed_bytes8  reversed_bytes9  active2  \n",
       "0              153              127     4708  \n",
       "1                2            65509     1064  \n",
       "\n",
       "[2 rows x 44 columns]"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from mootdx.quotes import Quotes\n",
    "\n",
    "client = Quotes.factory(market='std')\n",
    "client.quotes(symbol=[\"000001\", \"600300\"])  # 实时行情"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>open</th>\n",
       "      <th>close</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>vol</th>\n",
       "      <th>amount</th>\n",
       "      <th>year</th>\n",
       "      <th>month</th>\n",
       "      <th>day</th>\n",
       "      <th>hour</th>\n",
       "      <th>minute</th>\n",
       "      <th>datetime</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>50.50</td>\n",
       "      <td>50.61</td>\n",
       "      <td>50.71</td>\n",
       "      <td>50.50</td>\n",
       "      <td>4.673000e+05</td>\n",
       "      <td>2.364646e+07</td>\n",
       "      <td>2021</td>\n",
       "      <td>9</td>\n",
       "      <td>16</td>\n",
       "      <td>14</td>\n",
       "      <td>51</td>\n",
       "      <td>2021-09-16 14:51</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>50.61</td>\n",
       "      <td>50.54</td>\n",
       "      <td>50.62</td>\n",
       "      <td>50.51</td>\n",
       "      <td>3.713000e+05</td>\n",
       "      <td>1.877274e+07</td>\n",
       "      <td>2021</td>\n",
       "      <td>9</td>\n",
       "      <td>16</td>\n",
       "      <td>14</td>\n",
       "      <td>52</td>\n",
       "      <td>2021-09-16 14:52</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>50.53</td>\n",
       "      <td>50.53</td>\n",
       "      <td>50.60</td>\n",
       "      <td>50.52</td>\n",
       "      <td>6.759000e+05</td>\n",
       "      <td>3.416038e+07</td>\n",
       "      <td>2021</td>\n",
       "      <td>9</td>\n",
       "      <td>16</td>\n",
       "      <td>14</td>\n",
       "      <td>53</td>\n",
       "      <td>2021-09-16 14:53</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>50.53</td>\n",
       "      <td>50.55</td>\n",
       "      <td>50.57</td>\n",
       "      <td>50.53</td>\n",
       "      <td>5.470000e+05</td>\n",
       "      <td>2.764109e+07</td>\n",
       "      <td>2021</td>\n",
       "      <td>9</td>\n",
       "      <td>16</td>\n",
       "      <td>14</td>\n",
       "      <td>54</td>\n",
       "      <td>2021-09-16 14:54</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>50.56</td>\n",
       "      <td>50.67</td>\n",
       "      <td>50.68</td>\n",
       "      <td>50.55</td>\n",
       "      <td>2.723000e+05</td>\n",
       "      <td>1.378253e+07</td>\n",
       "      <td>2021</td>\n",
       "      <td>9</td>\n",
       "      <td>16</td>\n",
       "      <td>14</td>\n",
       "      <td>55</td>\n",
       "      <td>2021-09-16 14:55</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>50.67</td>\n",
       "      <td>50.59</td>\n",
       "      <td>50.67</td>\n",
       "      <td>50.58</td>\n",
       "      <td>3.981000e+05</td>\n",
       "      <td>2.015437e+07</td>\n",
       "      <td>2021</td>\n",
       "      <td>9</td>\n",
       "      <td>16</td>\n",
       "      <td>14</td>\n",
       "      <td>56</td>\n",
       "      <td>2021-09-16 14:56</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>50.58</td>\n",
       "      <td>50.64</td>\n",
       "      <td>50.65</td>\n",
       "      <td>50.58</td>\n",
       "      <td>2.149000e+05</td>\n",
       "      <td>1.087846e+07</td>\n",
       "      <td>2021</td>\n",
       "      <td>9</td>\n",
       "      <td>16</td>\n",
       "      <td>14</td>\n",
       "      <td>57</td>\n",
       "      <td>2021-09-16 14:57</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>50.65</td>\n",
       "      <td>50.65</td>\n",
       "      <td>50.65</td>\n",
       "      <td>50.65</td>\n",
       "      <td>5.000000e+02</td>\n",
       "      <td>2.534400e+04</td>\n",
       "      <td>2021</td>\n",
       "      <td>9</td>\n",
       "      <td>16</td>\n",
       "      <td>14</td>\n",
       "      <td>58</td>\n",
       "      <td>2021-09-16 14:58</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>50.65</td>\n",
       "      <td>50.65</td>\n",
       "      <td>50.65</td>\n",
       "      <td>50.65</td>\n",
       "      <td>5.877472e-39</td>\n",
       "      <td>5.877472e-39</td>\n",
       "      <td>2021</td>\n",
       "      <td>9</td>\n",
       "      <td>16</td>\n",
       "      <td>14</td>\n",
       "      <td>59</td>\n",
       "      <td>2021-09-16 14:59</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>50.70</td>\n",
       "      <td>50.70</td>\n",
       "      <td>50.70</td>\n",
       "      <td>50.70</td>\n",
       "      <td>3.297000e+06</td>\n",
       "      <td>1.671580e+08</td>\n",
       "      <td>2021</td>\n",
       "      <td>9</td>\n",
       "      <td>16</td>\n",
       "      <td>15</td>\n",
       "      <td>0</td>\n",
       "      <td>2021-09-16 15:00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    open  close   high    low           vol        amount  year  month  day  \\\n",
       "0  50.50  50.61  50.71  50.50  4.673000e+05  2.364646e+07  2021      9   16   \n",
       "1  50.61  50.54  50.62  50.51  3.713000e+05  1.877274e+07  2021      9   16   \n",
       "2  50.53  50.53  50.60  50.52  6.759000e+05  3.416038e+07  2021      9   16   \n",
       "3  50.53  50.55  50.57  50.53  5.470000e+05  2.764109e+07  2021      9   16   \n",
       "4  50.56  50.67  50.68  50.55  2.723000e+05  1.378253e+07  2021      9   16   \n",
       "5  50.67  50.59  50.67  50.58  3.981000e+05  2.015437e+07  2021      9   16   \n",
       "6  50.58  50.64  50.65  50.58  2.149000e+05  1.087846e+07  2021      9   16   \n",
       "7  50.65  50.65  50.65  50.65  5.000000e+02  2.534400e+04  2021      9   16   \n",
       "8  50.65  50.65  50.65  50.65  5.877472e-39  5.877472e-39  2021      9   16   \n",
       "9  50.70  50.70  50.70  50.70  3.297000e+06  1.671580e+08  2021      9   16   \n",
       "\n",
       "   hour  minute          datetime  \n",
       "0    14      51  2021-09-16 14:51  \n",
       "1    14      52  2021-09-16 14:52  \n",
       "2    14      53  2021-09-16 14:53  \n",
       "3    14      54  2021-09-16 14:54  \n",
       "4    14      55  2021-09-16 14:55  \n",
       "5    14      56  2021-09-16 14:56  \n",
       "6    14      57  2021-09-16 14:57  \n",
       "7    14      58  2021-09-16 14:58  \n",
       "8    14      59  2021-09-16 14:59  \n",
       "9    15       0  2021-09-16 15:00  "
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "client.bars(symbol='600036', frequency=8, offset=10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>open</th>\n",
       "      <th>close</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>vol</th>\n",
       "      <th>amount</th>\n",
       "      <th>year</th>\n",
       "      <th>month</th>\n",
       "      <th>day</th>\n",
       "      <th>hour</th>\n",
       "      <th>minute</th>\n",
       "      <th>datetime</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>50.50</td>\n",
       "      <td>50.61</td>\n",
       "      <td>50.71</td>\n",
       "      <td>50.50</td>\n",
       "      <td>4.673000e+05</td>\n",
       "      <td>2.364646e+07</td>\n",
       "      <td>2021</td>\n",
       "      <td>9</td>\n",
       "      <td>16</td>\n",
       "      <td>14</td>\n",
       "      <td>51</td>\n",
       "      <td>2021-09-16 14:51</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>50.61</td>\n",
       "      <td>50.54</td>\n",
       "      <td>50.62</td>\n",
       "      <td>50.51</td>\n",
       "      <td>3.713000e+05</td>\n",
       "      <td>1.877274e+07</td>\n",
       "      <td>2021</td>\n",
       "      <td>9</td>\n",
       "      <td>16</td>\n",
       "      <td>14</td>\n",
       "      <td>52</td>\n",
       "      <td>2021-09-16 14:52</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>50.53</td>\n",
       "      <td>50.53</td>\n",
       "      <td>50.60</td>\n",
       "      <td>50.52</td>\n",
       "      <td>6.759000e+05</td>\n",
       "      <td>3.416038e+07</td>\n",
       "      <td>2021</td>\n",
       "      <td>9</td>\n",
       "      <td>16</td>\n",
       "      <td>14</td>\n",
       "      <td>53</td>\n",
       "      <td>2021-09-16 14:53</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>50.53</td>\n",
       "      <td>50.55</td>\n",
       "      <td>50.57</td>\n",
       "      <td>50.53</td>\n",
       "      <td>5.470000e+05</td>\n",
       "      <td>2.764109e+07</td>\n",
       "      <td>2021</td>\n",
       "      <td>9</td>\n",
       "      <td>16</td>\n",
       "      <td>14</td>\n",
       "      <td>54</td>\n",
       "      <td>2021-09-16 14:54</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>50.56</td>\n",
       "      <td>50.67</td>\n",
       "      <td>50.68</td>\n",
       "      <td>50.55</td>\n",
       "      <td>2.723000e+05</td>\n",
       "      <td>1.378253e+07</td>\n",
       "      <td>2021</td>\n",
       "      <td>9</td>\n",
       "      <td>16</td>\n",
       "      <td>14</td>\n",
       "      <td>55</td>\n",
       "      <td>2021-09-16 14:55</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>50.67</td>\n",
       "      <td>50.59</td>\n",
       "      <td>50.67</td>\n",
       "      <td>50.58</td>\n",
       "      <td>3.981000e+05</td>\n",
       "      <td>2.015437e+07</td>\n",
       "      <td>2021</td>\n",
       "      <td>9</td>\n",
       "      <td>16</td>\n",
       "      <td>14</td>\n",
       "      <td>56</td>\n",
       "      <td>2021-09-16 14:56</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>50.58</td>\n",
       "      <td>50.64</td>\n",
       "      <td>50.65</td>\n",
       "      <td>50.58</td>\n",
       "      <td>2.149000e+05</td>\n",
       "      <td>1.087846e+07</td>\n",
       "      <td>2021</td>\n",
       "      <td>9</td>\n",
       "      <td>16</td>\n",
       "      <td>14</td>\n",
       "      <td>57</td>\n",
       "      <td>2021-09-16 14:57</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>50.65</td>\n",
       "      <td>50.65</td>\n",
       "      <td>50.65</td>\n",
       "      <td>50.65</td>\n",
       "      <td>5.000000e+02</td>\n",
       "      <td>2.534400e+04</td>\n",
       "      <td>2021</td>\n",
       "      <td>9</td>\n",
       "      <td>16</td>\n",
       "      <td>14</td>\n",
       "      <td>58</td>\n",
       "      <td>2021-09-16 14:58</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>50.65</td>\n",
       "      <td>50.65</td>\n",
       "      <td>50.65</td>\n",
       "      <td>50.65</td>\n",
       "      <td>5.877472e-39</td>\n",
       "      <td>5.877472e-39</td>\n",
       "      <td>2021</td>\n",
       "      <td>9</td>\n",
       "      <td>16</td>\n",
       "      <td>14</td>\n",
       "      <td>59</td>\n",
       "      <td>2021-09-16 14:59</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>50.70</td>\n",
       "      <td>50.70</td>\n",
       "      <td>50.70</td>\n",
       "      <td>50.70</td>\n",
       "      <td>3.297000e+06</td>\n",
       "      <td>1.671580e+08</td>\n",
       "      <td>2021</td>\n",
       "      <td>9</td>\n",
       "      <td>16</td>\n",
       "      <td>15</td>\n",
       "      <td>0</td>\n",
       "      <td>2021-09-16 15:00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    open  close   high    low           vol        amount  year  month  day  \\\n",
       "0  50.50  50.61  50.71  50.50  4.673000e+05  2.364646e+07  2021      9   16   \n",
       "1  50.61  50.54  50.62  50.51  3.713000e+05  1.877274e+07  2021      9   16   \n",
       "2  50.53  50.53  50.60  50.52  6.759000e+05  3.416038e+07  2021      9   16   \n",
       "3  50.53  50.55  50.57  50.53  5.470000e+05  2.764109e+07  2021      9   16   \n",
       "4  50.56  50.67  50.68  50.55  2.723000e+05  1.378253e+07  2021      9   16   \n",
       "5  50.67  50.59  50.67  50.58  3.981000e+05  2.015437e+07  2021      9   16   \n",
       "6  50.58  50.64  50.65  50.58  2.149000e+05  1.087846e+07  2021      9   16   \n",
       "7  50.65  50.65  50.65  50.65  5.000000e+02  2.534400e+04  2021      9   16   \n",
       "8  50.65  50.65  50.65  50.65  5.877472e-39  5.877472e-39  2021      9   16   \n",
       "9  50.70  50.70  50.70  50.70  3.297000e+06  1.671580e+08  2021      9   16   \n",
       "\n",
       "   hour  minute          datetime  \n",
       "0    14      51  2021-09-16 14:51  \n",
       "1    14      52  2021-09-16 14:52  \n",
       "2    14      53  2021-09-16 14:53  \n",
       "3    14      54  2021-09-16 14:54  \n",
       "4    14      55  2021-09-16 14:55  \n",
       "5    14      56  2021-09-16 14:56  \n",
       "6    14      57  2021-09-16 14:57  \n",
       "7    14      58  2021-09-16 14:58  \n",
       "8    14      59  2021-09-16 14:59  \n",
       "9    15       0  2021-09-16 15:00  "
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "client.bars(symbol='600036', frequency=7, offset=10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "Empty DataFrame\n",
       "Columns: []\n",
       "Index: []"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "client = Quotes.factory(market='ext')\n",
    "client.quote(market=47, symbol=\"CU2110\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "Empty DataFrame\n",
       "Columns: []\n",
       "Index: []"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "client = Quotes.factory(market='ext')\n",
    "client.markets()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
